<?php
/**
 * @brief 
 *
 * @license		http://www.gnu.org/licenses/gpl-3.0.txt GNU General Public License
 * @copyright	2008 David Singer
 * @author		David Singer <david@ramaboo.com>
 * @version		1.0.0
 */

require_once('../../includes/common.php');

try {
	// check required params
	if (!isset($_POST['zone'])) {
		throw new Exception("Zone is required.");
	}
	$zone = htmlentities(strtolower(trim($_POST['zone'])));
	
	if (!isset($_POST['id'])) {
		throw new Exception("Id is required.");
	}
	$id = intval(trim($_POST['id']));
	
	$json = array();
	
	$record = new Record;
	$record->open($id);
	$record->remove();
	
	$json['success'] = true;
	$json['msg'] = "Record $id removed.";
} catch (Exception $e) {
	$json['success'] = false;
	$json['msg'] = $e->getMessage();
}

$output = json_encode($json);
header_no_cache(strlen($output), 'application/json');
echo $output;
?>